package com.rado.tf.gui.view.application.impl;

import com.rado.tf.gui.view.application.IApplicationView;
import com.rado.tf.gui.view.common.impl.AbstractViewImpl;
import com.vaadin.server.Sizeable;
import com.vaadin.ui.ComponentContainer;
import com.vaadin.ui.HorizontalSplitPanel;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.themes.ChameleonTheme;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * Created by parado on 17.03.14.
 */
@Component(ApplicationViewImpl.BEAN_NAME)
public class ApplicationViewImpl extends AbstractViewImpl implements IApplicationView
{
   public static final String BEAN_NAME = "applicationView";

   private VerticalLayout bodyContainer;

   private VerticalLayout menuContainer;

   @Override
   @PostConstruct
   public void init()
   {
      setSizeFull();
      menuContainer = new VerticalLayout();
      menuContainer.setSizeFull();

      bodyContainer = new VerticalLayout();
      bodyContainer.setSizeFull();

      HorizontalSplitPanel splitPanel = new HorizontalSplitPanel(menuContainer, bodyContainer);
      splitPanel.setStyleName(ChameleonTheme.SPLITPANEL_SMALL);
      splitPanel.setSplitPosition(250, Sizeable.Unit.PIXELS);

      addComponent(splitPanel);
   }

   @Override
   public ComponentContainer getBodyContainer()
   {
      return bodyContainer;
   }

   @Override
   public ComponentContainer getMenuContainer()
   {
      return menuContainer;
   }
}
